package com.cloudcc.mobile.adapter;

import java.util.List;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.cloudcc.mobile.R;

public class RelevantPopAdapter extends BaseAdapter{
	private Context context;
	private List<String> list;
	public RelevantPopAdapter(Context context, List<String> list) {
		super();
		this.context = context;
		this.list = list;
	}
	@Override
	public int getCount() {
		return list.size();
	}

	@Override
	public String getItem(int position) {
		return list.get(position);
	}

	@Override
	public long getItemId(int position) {
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		ViewHolder hodler;
		if(convertView==null){
			convertView=LayoutInflater.from(context).inflate(R.layout.relevant_pop_item, null);
			hodler=new ViewHolder();
			hodler.name=(TextView)convertView.findViewById(R.id.relevant_pop_list_item);
			convertView.setTag(hodler);
		}else{
			hodler=(ViewHolder) convertView.getTag();
		}
		hodler.name.setText(list.get(position));
		return convertView;
	}

	class ViewHolder {
		TextView name;
	}
}
